<template>
	<view class="page">
		<view class="top">
			{{detail.status == 0 ? '待发货' : detail.status == 1 ? '已发货' :  detail.status == 2 ? '已签收' :  '' }}
		</view>
		<view class="centent">
			<view class="address dis aic jcsb">
				<view class="">
					<view class="dis aic ">
						<view class="name">收件人：{{detail.memberName}} </view>
						<view class="phone">{{detail.phone}}</view>
					</view>
					<view class="add">{{detail.province}}{{detail.city}}{{detail.area}}{{detail.address}}</view>
				</view>
				<view class="icon_box">
					<image src="/static/icon/icon_right.png" mode="widthFix" style="width: 100%;"></image>
				</view>
			</view>
			<view class="detail dis aic jcsb">
				<view class="img_box">
					<image src="/static/tabs/0.png" mode="aspectFit" style="width: 100%;height: 100%;"></image>
				</view>
				<view>
					<view class="name">
						{{detail.goodName}}
					</view>
					<view class="price">
						{{detail.consumePoints}}分
					</view>
				</view>
			</view>
			<view class="li">
				<view class="lable">
					订单编号
				</view>
				<view class="value dis aic">
					<view class="">{{detail.orderNum}}</view>
					<view class="copy" @click="copy(detail.orderNum)">复制</view>
				</view>
			</view>
			<!-- <view class="li">
				<view class="lable">
					积分
				</view>
				<view class="value">
					<view class="">-{{}}分</view>
				</view>
			</view> -->
			<view class="li">
				<view class="lable">
					兑换时间
				</view>
				<view class="value ">
					<view class="">{{detail.createTime}}</view>
				</view>
			</view>
			<view class="li" v-if="detail.waybillNumber	">
				<view class="lable">
					快递单号
				</view>
				<view class="value dis aic">
					<view class="">{{detail.waybillNumber}}</view>
					<view class="copy" @click="copy(detail.waybillNumber)">复制</view>
				</view>
			</view>
		</view>

		<view class="btn">
			确认收货
		</view>
		<!-- <view class="btn">
			删除订单
		</view> -->
	</view>
</template>

<script>
	import {
		pointsOrderQueryById
	} from '@/api.js'
	export default {
		data() {
			return {
				id: '',
				detail: {}
			}
		},

		onLoad(opt) {
			if (opt.id) {
				this.id = opt.id
				this.getDetail()
			}
		},
		methods: {
			copy(text) {
				uni.setClipboardData({
					data: text,
					success: () => {
						uni.showToast({
							title: '复制成功',
							icon: 'none'
						});
					},
					fail: (err) => {
						uni.showToast({
							title: '复制失败',
							icon: 'none'
						});
					}
				});
			},
			async getDetail() {
				let res = await pointsOrderQueryById({
					id: this.id
				})
				if (res.code == 200) {
					this.detail = res.result
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	.page {
		height: 100vh;
		width: 750rpx;
		background: #FF9C06;
	}

	.top {
		width: 750rpx;
		height: 170rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-family: Roboto, Roboto;
		font-weight: bold;
		font-size: 33rpx;
		color: #FFFFFF;
	}

	.centent {
		background: #fff;
		width: 750rpx;
		box-shadow: 0rpx 7rpx 11rpx 0rpx rgba(233, 233, 233, 0.25);
		border-radius: 27rpx 27rpx 0rpx 0rpx;
		height: calc(100vh - 170rpx);

		.address {
			width: 750rpx;
			height: 180rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 7rpx 11rpx 0rpx rgba(233, 233, 233, 0.25);
			border-radius: 27rpx 27rpx 0rpx 0rpx;
			padding: 50rpx 40rpx;
			box-sizing: border-box;

			.icon_box {
				width: 22rpx;
			}

			.name {
				font-family: Roboto, Roboto;
				font-weight: bold;
				font-size: 27rpx;
				color: #303030;
			}

			.phone {
				font-family: Roboto, Roboto;
				font-size: 27rpx;
				color: #6C6C6C;
				margin-left: 20rpx;
			}

			.add {
				font-family: Roboto, Roboto;
				font-weight: 500;
				font-size: 25rpx;
				color: #6C6C6C;
				margin-top: 20rpx;
			}
		}

		.detail {
			padding: 0 30rpx;
			box-sizing: border-box;
			margin-bottom: 40rpx;

			.img_box {
				width: 284rpx;
				height: 176rpx;
			}

			.name {
				font-family: Roboto Mono, Roboto Mono;
				font-weight: 300;
				font-size: 33rpx;
				color: #000000;
				width: 364rpx;
			}

			.price {
				font-family: Roboto, Roboto;
				font-weight: 500;
				font-size: 43rpx;
				color: #000000;
				text-align: right;
				margin-top: 40rpx;
			}
		}

		.li {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin: 30rpx 0 0 0;
			padding: 0 30rpx;
			box-sizing: border-box;


			.lable {
				width: 101rpx;
				height: 29rpx;
				font-family: Roboto, Roboto;
				font-weight: 500;
				font-size: 25rpx;
				color: #696969;
			}

			.value {
				height: 29rpx;
				font-family: Roboto, Roboto;
				font-weight: 500;
				font-size: 25rpx;
				color: #646464;
			}

			.copy {
				width: 60rpx;
				height: 29rpx;
				font-family: Roboto, Roboto;
				font-weight: 500;
				font-size: 22rpx;
				color: #FF7373;
				text-align: center;
				background: #FFFFFF;
				border-radius: 2rpx 2rpx 2rpx 2rpx;
				border: 2rpx solid #FF7373;
				margin-left: 10rpx;
			}
		}
	}

	.btn {
		position: fixed;
		bottom: 60rpx;
		width: 250rpx;
		left: 250rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		background: #FF9C06;
		color: #fff;
		border-radius: 1812rpx 1812rpx 1812rpx 1812rpx;
	}
</style>